var taskDataStore;
taskDataStore = Ext.create("Ext.data.Store", {
	autoLoad : false,
	proxy : {
		type : "ajax",
		url : "/fk-acti/task/get_list_by_instance",
		actionMethods : {
			read : "GET" // Store设置请求的方法，与Ajax请求有区别
		},
		reader : {
			type : "json",
			rootProperty : "data", // 数据(不配置的话无法接收数据)，返回的key为data
			root : "result.list",
		}
	}
}); // #taskDataStore

var taskListGridPanel = Ext.create("Ext.grid.Panel", {
	title : "",
	id : "aaa",
	viewConfig : { enableTextSelection : true },
	store : taskDataStore,
	columns : [ {
		header: "序号",
		xtype: "rownumberer",
		width: 60,
		align: "center"
	},
	{
		text: "任务ID",
		dataIndex: "id",
		hidden: true,
		flex: 1
	},
	{
		text: "任务名称",
		dataIndex: "name",
		flex: 1
	},
	{
		text: "执行人",
		dataIndex: "assignee",
		flex: 1
	},
	{
		text: "实例ID",
		dataIndex: "processInstanceId",
		hidden: true,
		flex: 1
	},
	{
		text: "业务key",
		dataIndex: "taskDefinitionKey",
		flex: 1,
		hidden: true
	},
	
	{
		text: "流程定义ID",
		dataIndex: "processDefinitionId",
		flex: 1,
		hidden: true
	},
	{
		text: "启动时间",
		dataIndex: "startTime",
		renderer: Ext.util.Format.dateRenderer('Y-m-d'),
		flex: 1
	},
	{
		text: "结束时间",
		dataIndex: "endTime",
		renderer: Ext.util.Format.dateRenderer('Y-m-d'),
		flex: 1
	},
	{
		text: "流程状态",
		dataIndex: "deleteReason",
		flex: 1,
		renderer : function(val){
			console.log(val)
			if(val==null){
				return "<span style='color:blue;'>进行中</span>";
			}else if(val=='completed'){
				return "<span style='color:gray;'>已完成</span>";
			}else{
				return val;
			}
		}
	}]
}); // #listGridPanel

var processInstanceTaskList_win = Ext.create("Ext.Window", {
	title : "流程进度",
	closeAction : "hide",
	width : 800,
	items : taskListGridPanel
});
function processInstanceTaskList(processInstanceId) {
	Ext.apply(taskDataStore.proxy.extraParams, {processInstanceId:processInstanceId});
	taskDataStore.load();
	processInstanceTaskList_win.show();
}
